import { createRouter, createWebHistory } from 'vue-router'
import Layout from '../layout/index.vue'
import Login from '../views/Login.vue'

/**
 * 常量路由
 */
export const routes = [
    {
        path: "/",
        component: Layout,
        name: 'Layout',
        redirect: "/dashboard",
        meta: {
            // 是否在左侧菜单栏隐藏 true 隐藏 flase 不隐藏
            hidden: false
        },
        /**
         * 后面动态添加的路由都在 children 里面
         */
        children: [
            {
                path: "dashboard",
                component: () => import("@/views/Dashboard.vue"),
                name: "Dashboard",
                meta: {
                    title: "首页",
                    icon: "dashboard",
                   
                }
            },
        ],
    },
    {
        path: '/login',
        component: Login,
        name: 'Login',
        meta: {
            // 是否在左侧菜单栏隐藏 true 隐藏 flase 不隐藏
            hidden: true
        }
    },
]

const router = createRouter({
    routes,
    history: createWebHistory()
})

export default router